import { CrossDefenceCopyMenuBase } from "./CrossDefenceCopyMenuBase";
import { CrossDefenceBlessItemTips } from "./item/CrossDefenceBlessItemTips";
import { CrossDefenceBlessData } from "./data/CrossDefenceBlessData";
import { CrossDefenceBlessItem } from "./item/CrossDefenceBlessItem";
//class CrossDefenceCopyBlessMenu
    
    export  class CrossDefenceCopyBlessMenu extends CrossDefenceCopyMenuBase
    {
        constructor(arg1: Array<any>, arg2: Boolean=false, arg3: string="", arg4: string="")
        {
            super(_buildingImgs, "CrossTowerBlessTitle.png", "CrossTowerBlessIcon.png", CrossDefenceBlessItemTips, arg2, arg3, arg4);
            _buildingImgs = arg1;
            _skillMaxNum = _buildingImgs.length;
            return;
        }

        public updateBlassData(arg1: Array<any>): void
        {
            var loc2=null;
            var loc3=null;
            var loc1=0;
            while (loc1 < arg1.length && loc1 < _items.length) 
            {
                loc2 = arg1[loc1] as CrossDefenceBlessData;
                (loc3 = _items[loc1] as CrossDefenceBlessItem).canUpgrade = loc2.canUpgrade;
                loc3.actived = loc2.actived;
                loc3.blessData = loc2;
                ++loc1;
            }
            return;
        }

        protected /* override */ createChildren(): void
        {
            var loc1=null;
            var loc3=null;
            super.createChildren();
            _items = [];
            var loc2=0;
            while (loc2 < _buildingImgs.length) 
            {
                loc3 = _buildingImgs[loc2];
                loc1 = new CrossDefenceBlessItem(loc3);
                loc1.x = loc2 * _skillSlotWidth;
                loc1.y = 0;
                loc1.addEventListener(flash.events.Event.ADDED_TO_STAGE, onAddToStage);
                _container.addChild(loc1);
                _items.push(loc1);
                ++loc2;
            }
            return;
        }
    }
